require 'test/unit'
require_relative 'poker.rb'

class TC_Report < Test::Unit::TestCase

  def test_generate_report_from_poker_object
    players = [Player.new("John"), Player.new("Mary"), Player.new("Luke"), Player.new("Eimear")]
    poker_game = Poker.new 10, players
    poker_game.play
    poker_game.generate_report PlainReport
    assert poker_game.is_report_init?

    poker_game.generate_report HtmlReport
    assert poker_game.is_report_init?

    poker_game.generate_report XMLReport
    assert poker_game.is_report_init?

    poker_game.generate_report RdfReport
    assert poker_game.is_report_init?
  end

  def test_report_plain
    plain = PlainReport.new (Report_Base.new [Player.new("Tester"), Player.new("Joe")], 5, Hash.new('Joe'=>[Card.new(:CLUBS,:ACE)], 'Tester'=>[Card.new(:SPADES,:KING)]), Deck.new)
    assert_nil plain.generate_report
    assert_instance_of PlainReport, plain
  end

  def test_report_html
    html = HtmlReport.new (Report_Base.new [Player.new("Tester"), Player.new("Joe")], 5, Hash.new('Joe'=>[Card.new(:CLUBS,:ACE)], 'Tester'=>[Card.new(:SPADES,:KING)]), Deck.new)
    assert_nil html.generate_report
    assert_instance_of HtmlReport, html
  end

  def test_report_xml
    xml = XMLReport.new (Report_Base.new [Player.new("Tester"), Player.new("Joe")], 5, Hash.new('Joe'=>[Card.new(:CLUBS,:ACE)], 'Tester'=>[Card.new(:SPADES,:KING)]), Deck.new)
    assert_nil xml.generate_report
    assert_instance_of XMLReport, xml
  end

  def test_report_rdf
    rdf = RdfReport.new (Report_Base.new [Player.new("Tester"), Player.new("Joe")], 5, Hash.new('Joe'=>[Card.new(:CLUBS,:ACE)], 'Tester'=>[Card.new(:SPADES,:KING)]), Deck.new)
    assert_nil rdf.generate_report
    assert_instance_of RdfReport, rdf
  end

end